<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<!--[if lt IE 9]>
    		<script src="../js/jquery-1.11.3.js"></script>    
		<![endif]-->
		<!--[if gte IE 9]><!-->
		<script src="../js/jquery-3.1.1.js"></script>
		<!--<![endif]-->
		<script src="../js/jquery.jsonp.js"></script>
		<script type="text/javascript">
			vurl = "../text/new.xml";

			function funget() {
				$.get(vurl, function(xml) {
					console.log("lenght:" + $(xml).find("item").length);
					$(xml).find("field").each(function() {
						var field = $(this);
						var fName = field.attr("Name"); //读取节点属性
						var dataType = field.find("datatype").text(); //读取子节点的值
						console.log("field:" + field);
						console.log("fName:" + fName);
						console.log("dataType:" + dataType);
					});
				});
			}

			function funxml() {
				$.ajax({
					url: vurl,
					dataType: 'xml',
					success: function(data) {
						//console.log(data);
						$(data).find("fields").find("field").each(function(index, ele) {
							var titles = $(ele).find("fieldname").text();
							var links = $(ele).find("datatype").text();
						//	console.log(titles + '-----');
							$("#noticecon").find('ol').append('<li><a href="' + links + '">' + titles + '</a></li>');
						});
					}
				});

			}
		</script>
	</head>

	<body>
		<button onclick="funget()">请求并获取返回结果 jquery</button><br>
		<div id=noticecon ><ol/></div>
		<button onclick="funxml()">请求并获取返回结果 jquery</button><br>
	</body>

</html>